jQuery(function($){
	$('#deptTree').ace_tree({
		dataSource: treeDataSource ,
		multiSelect:true,
		loadingHTML:'<div class="tree-loading"><i class="icon-refresh icon-spin blue"></i></div>',
		'open-icon' : 'icon-minus',
		'close-icon' : 'icon-plus',
		'selectable' : true,
		'selected-icon' : 'icon-ok',
		'unselected-icon' : 'icon-remove'
	});

	
	$('#deptTree').on('loaded', function (evt, data) {
		/*alert("load");
		console.log(evt);
		console.log(data);*/
	});

	$('#deptTree').on('opened', function (evt, data) {
		/*alert("open");
		console.log(evt);
		console.log(data);*/
	});

	$('#deptTree').on('closed', function (evt, data) {
		/*alert("closed");
		console.log(evt);
		console.log(data);*/
	});

	$('#deptTree').on('selected', function (evt, data) {
		/*alert("selected");
		console.log(evt);
		console.log(data);*/
	});
	
	//模态框
	
	$('#modal-form input[type=file]').ace_file_input({
		style:'well',
		btn_choose:'Drop files here or click to choose',
		btn_change:null,
		no_icon:'icon-cloud-upload',
		droppable:true,
		thumbnail:'large'
	})
	
	//chosen plugin inside a modal will have a zero width because the select element is originally hidden
	//and its width cannot be determined.
	//so we set the width after modal is show
	$('#modal-form').on('shown.bs.modal', function () {
		$(this).find('.chosen-container').each(function(){
			$(this).find('a:first-child').css('width' , '210px');
			$(this).find('.chosen-drop').css('width' , '210px');
			$(this).find('.chosen-search input').css('width' , '200px');
		});
	})
	/**
	//or you can activate the chosen plugin after modal is shown
	//this way select element becomes visible with dimensions and chosen works as expected
	$('#modal-form').on('shown', function () {
		$(this).find('.modal-chosen').chosen();
	})
	*/
	
});


/**
 *新增部门 
 */
function addDept(){
	
}